import { toString } from "@lib/com.verify";

export class TransformerVarchar {
  private isEmpty: boolean = false;
  constructor(options?: { isReadEmpty: boolean }) {
    this.isEmpty = options?.isReadEmpty ?? false;
  }

  private trans(mess: any) {
    return this.isEmpty ? "" : toString(mess);
  }

  to(mess: any): string {
    return this.trans(mess);
  }

  from(mess: any): string {
    return this.trans(mess);
  }
}
export class TransformerVarchar50 {
  private isEmpty: boolean = false;
  constructor(options?: { isReadEmpty: boolean }) {
    this.isEmpty = options?.isReadEmpty ?? false;
  }

  private trans(mess: any) {
    return this.isEmpty ? "" : toString(mess).substring(0, 50);
  }

  to(mess: any): string {
    return this.trans(mess);
  }

  from(mess: any): string {
    return this.trans(mess);
  }
}
export class TransformerVarchar255 {
  private isEmpty: boolean = false;
  constructor(options?: { isReadEmpty: boolean }) {
    this.isEmpty = options?.isReadEmpty ?? false;
  }

  private trans(mess: any) {
    return this.isEmpty ? "" : toString(mess).substring(0, 255);
  }

  to(mess: any): string {
    return this.trans(mess);
  }

  from(mess: any): string {
    return this.trans(mess);
  }
}
